import { defineConfig } from 'vitepress'
import { componentPreview, containerPreview } from '@vitepress-demo-preview/plugin'
import { resolve } from 'path'

const alias = { '@': resolve(__dirname, '../components') }

export default defineConfig({
  markdown: {
    config(md) {
      md.use(containerPreview, { clientOnly: true })
      md.use(componentPreview, { clientOnly: true })
    },
  },
  vite: { resolve: { alias } },
  title: 'ZL Crud',
  description: '快速开发后台管理系统',

  themeConfig: {
    nav: [
      { text: '指南', link: '/' },
      { text: '表格组件', link: '/components/crud-simple/' },
      { text: '表单组件', link: '/components/form/' },
    ],

    sidebar: [
      { text: '介绍', items: [{ text: '快速开始', link: '/' }] },
      {
        text: '表格组件',
        items: [
          { text: 'Crud 增删改查', link: '/components/crud/' },
          { text: 'CrudSimple 简易增删改查', link: '/components/crud-simple/' },
        ],
      },

      {
        text: '表单组件',
        items: [
          { text: 'Form 表单', link: '/components/form/' },
          { text: 'FormDialog 表单弹窗', link: '/components/form-dialog/' },
          { text: 'Autocomplete 自动补全输入框', link: '/components/autocomplete/' },
          { text: 'Address 地址选择器', link: '/components/address/' },
          { text: 'Editor 富文本', link: '/components/editor/' },
          { text: 'Upload 文件上传', link: '/components/upload/' },
          { text: 'Title 标题', link: '/components/title/' },
          { text: 'SelectPopover 下拉选择器', link: '/components/select-popover/' },
          { text: 'SelectUserInput 用户选择输入框', link: '/components/select-user-input/' },
          { text: 'SelectUserItem 用户选择项', link: '/components/select-user-item/' },
        ],
      },
      { text: '弹出组件', items: [{ text: 'Dialog 弹窗', link: '/components/dialog/' }] },
      { text: '其他组件', items: [{ text: 'Verify 验证码', link: '/components/verify/' }] },
    ],

    socialLinks: [{ icon: 'github', link: 'https://gitee.com/FlyingSky7_admin/zl-crud-web.git' }],
  },
})
